from dataclasses import dataclass
from dataclasses_json import dataclass_json

@dataclass_json
@dataclass
class Person:
    name: str
    age: int

person = Person(name="Alice", age=30)
json_str = person.to_json()  # 输出: {"name": "Alice", "age": 30}
print(json_str)
